﻿<?php include $this->admin_tpl('meta');?>
<title>基础</title>
</head>
<body>
<div class="page-container" style="padding-bottom:0;">
	<form id="search">
		<input type="hidden" value="" name="field">
		<input type="hidden" value="" name="order">
		<span class="select-box inline">
			<select name="status" class="select">
			<option value="">请选择平台</option>
			<?php $platform = get_setting('collect_platform');foreach($platform as $k=>$v){ if($k>0){?>
			<option value="<?php echo $k;?>"><?php echo $v;?></option>
			<?php }}?>
			</select>
		</span>
		<input type="text" name="shop_name" class="input-text search" placeholder="店铺名称" autocomplete="off">
		<input type="text" name="start" class="input-text search" placeholder="订单开始时间" autocomplete="off">
		<input type="text" name="end" class="input-text search" placeholder="订单开始时间" autocomplete="off">
		<a class="btn btn-success radius" href="javascript:void(0)" id="btn_search"><i class="yzm-iconfont yzm-iconsousuo"></i> 搜索</a>
		<button class="btn btn-primary radius" id="btn_reset" type="reset"><i class="yzm-iconfont yzm-iconshuaxin"></i> 重置</button>
	</form>
	<table id="table" class="mt-20" lay-filter="table"></table>
</div>

<script type="text/html" id="tool_temp">
	<a href="javascript:;" id="btn_del" class="btn btn-danger radius"><i class="yzm-iconfont yzm-iconshanchu2"></i> 批量删除</a>
	<a id="btn_upload" class="btn btn-primary radius" lay-options="{accept: 'file',exts: 'xlsx'}"><i class="yzm-iconfont yzm-iconshangchuan"></i> 批量导入</a>
</script>
<script type="text/html" id="op_temp">
	<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="delete" style="text-decoration:none;">删除</a>
</script>

<script type='text/html' id="upload_temp">
	<div class="layui-upload-drag" style="display: block;" id="upload-drag">
		<i class="layui-icon layui-icon-upload" style="color:#1E9FFF;"></i> 
		<div>点击上传，或将文件拖拽到此处</div>
		<div class="layui-hide" id="upload-preview">
		<hr> <img src="" alt="上传成功后渲染" style="max-width: 100%">
		</div>
	</div>
</script>
<?php include $this->admin_tpl('footer');?>
<script type="text/javascript" src="<?php echo STATIC_URL;?>plugin/layui/layui.js"></script>

<script>

layui.use(function(){ //亦可加载特定模块：layui.use(['layer', 'laydate', function(){
	table = layui.table; //表格
	util = layui.util; //工具集
	dropdown = layui.dropdown; //下拉菜单
	form = layui.form;
	laydate = layui.laydate;
	upload = layui.upload;
	laydate.render({
		elem: 'input[name="start"]'
	});
	laydate.render({
		elem: 'input[name="end"]'
	});
	//执行一个 table 实例
	option = {
		elem: '#table',
		height: 'full-80',
		limit:30,
		limits:[30,60,90],
		url:'<?php echo U('collect_fish');?>',
		where: $('#search').serializeJson(),
		title: '供应商列表',
		autoSort: false,
		page: {theme:'#409eff',groups:3,hash:true}, //开启分页
		toolbar: $('#tool_temp').html(), //开启工具栏，此处显示默认图标，可以自定义模板，详见文档
		cols: [[ //表头
			{type: 'checkbox', fixed: 'left'},
			{field: 'id', title: 'ID', width:80,align:'center'},
			{field: 'platform', title: '平台', width:80,align:'center'},
			{field: 'shop_name', title: '店铺名称',width:200,align:'center'},
			{field: 'order_id', title: '订单编号',align:'center'},
			{field: 'order_num', title: '下单件数', width:80,align:'center'},
			{field: 'order_price', title: '下单金额', width:80,align:'center'},
			{field: 'order_date', title: '日期',align:'center',templet: function(row) {return util.toDateString(row.order_date*1000,'yyyy-MM-dd');}},
			{field: 'add_time', title: '添加时间',align:'center', sort: true, width:200,templet: function(row) {return util.toDateString(row.add_time*1000);}},
			{fixed: 'right', title: '操作', width: 100, align:'center', toolbar: '#op_temp'}
		]],
		done:function(res,curr,count){
			public_table();
			
			$('#btn_upload').click(function(){
				layer.open({
				  title: '商品标签及补货规则',
				  content: $('#upload_temp').html(),
				  area: ['800px', '400px'], 
				  success: function(layero, index){
					upload.render({
						elem: '#upload-drag', // 绑定多个元素
						url: '<?php echo U('fish_input');?>', // 此处配置你自己的上传接口即可
						data:{'dir':'fish_file','yzm_csrf_token':yzm_csrf_token},
						accept: 'file', // 普通文件
						done: function(res){
							if(res.status ==1){
							
							}else{
								layer.msg(res.message, {icon:2,time:3000});
							}
						}
					});
				  }
				})
			})
		}
	};
	table.render(option);
	init_table('collect_fish');
})


	
</script>


</body>
</html>